<?php
/**
 * @Author: nic-tes
 * @Date:   2014-08-22 17:40:50
 * @Last Modified by:   nic-tes
 * @Last Modified time: 2014-09-05 15:58:10
 */
class Control extends SmartyView{
	private $var = array();

	public function __call($var,$arg){
		echo "<script>location.href='./index.php'</script>";
	}
	protected function success($msg,$url){
		header('Content-type:text/html;charset=utf-8');
		echo "<script>alert('$msg');location.href='$url'</script>";
		die;
	}

	protected function error($msg){
		header('Content-type:text/html;charset=utf-8');
		echo "<script>alert('$msg');window.history.back()</script>";
		die;
	}
	protected function back(){
		header('Content-type:text/html;charset=utf-8');
		echo "<script>window.history.back()</script>";
		die;
	}

	// /**
	//  * [display 载入模板]
	//  * @return [type] [description]
	//  */
	// protected function display($tpl = NULL){

	// 	// $varName = '我是变量';
	// 	//键名变为变量名，键值变为变量值
	// 	extract($this->var);
	// 	// array('a'=>1);
	// 	// $a = 1;

	// 	if(is_null($tpl)){
	// 		$path = APP_TPL_PATH . '/' . CONTROL . '/' . METHOD . '.html';
	// 	}else{//用户自己传递
	// 		//获得后缀
	// 		$type = ltrim(strrchr($tpl, '.'),'.');
	// 		//如果后缀为空 默认为.html后缀
	// 		if(empty($type)) $tpl .= '.html';
	// 		$path = APP_TPL_PATH . '/' . CONTROL . '/' . $tpl;
	// 	}
	// 	if(!is_file($path)) halt('模板：' . $path . '未找到！):');
	// 	include $path;
		
	// }

	// /**
	//  * [assign 分配变量]
	//  * @return [type] [description]
	//  */
	// protected function assign($var,$value){
	// 	// $this->var['varName'] = '我是变量'
	// 	$this->var[$var] = $value;
	// }

	// public function __set($var,$value){
	// 	$this->var[$var] = $value;
	// }
}
?>